package com.lujianfei.productprice.ui.addProduct;

import android.os.Parcel;
import android.os.Parcelable;

import com.orm.SugarRecord;
import com.orm.dsl.Column;
import com.orm.dsl.Ignore;
import com.orm.dsl.Table;

@Table(name = "ProductEntity")
public class ProductEntity extends SugarRecord implements Parcelable {

    @Column(name = "shopId")
    private long shopId;

    @Column(name = "productName")
    private String productName;

    @Ignore
    private String shopName;

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public long getShopId() {
        return shopId;
    }

    public void setShopId(long shopId) {
        this.shopId = shopId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Column(name = "imageUrl")
    private String imageUrl;

    @Column(name = "price")
    private double price;

    @Ignore
    private int quantity;

    public ProductEntity() {
    }

    protected ProductEntity(Parcel in) {
        shopId = in.readLong();
        productName = in.readString();
        shopName = in.readString();
        imageUrl = in.readString();
        price = in.readDouble();
        quantity = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(shopId);
        dest.writeString(productName);
        dest.writeString(shopName);
        dest.writeString(imageUrl);
        dest.writeDouble(price);
        dest.writeInt(quantity);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ProductEntity> CREATOR = new Creator<ProductEntity>() {
        @Override
        public ProductEntity createFromParcel(Parcel in) {
            return new ProductEntity(in);
        }

        @Override
        public ProductEntity[] newArray(int size) {
            return new ProductEntity[size];
        }
    };
}
